<!-- 登录拦截 -->
<script src="../assets/js/jquery.min.js"></script>
<script>
    var id = sessionStorage.getItem('userId')
    if (!id) {
        location.href = 'login.html'
    }
</script>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>后台管理-评论管理</title>
    <link rel="stylesheet" href="../assets/css/bootstrap.min.css">
    <link rel="stylesheet" href="../assets/css/admin/common.css">
    <link rel="stylesheet" href="../assets/css/admin/comments.css">
    <link rel="stylesheet" href="../assets/utils/nprogress/nprogress.css">
    <script src="../assets/utils/nprogress/nprogress.js"></script>
</head>

<body>
    <script>
        NProgress.start()
    </script>
    <!-- 1、左边导航栏区域 -->
    <div class="aside">
        <!-- 1-1-用户头像信息 -->
        <div class="user-info" id="userData">
            <img src="/assets/uploads/5.jpg" alt="">
            <h3>梦里百川</h3>
        </div>
        <!-- 1-2-菜单栏信息 -->
        <ul class="nav">
            <li>
                <a href="index.html"><span class="glyphicon glyphicon-equalizer"></span>首页</a>
            </li>

            <li>
                <a href="#menu-posts" class="collapsed" data-toggle="collapse">
                    <span class="glyphicon glyphicon-level-up"></span>文章<i class="glyphicon glyphicon-menu-down"></i>
                </a>
                <ul id="menu-posts" class="collapse">
                    <li><a href="allArticle.html">所有文章</a></li>
                    <li><a href="writeArticle.html">写文章</a></li>
                    <li><a href="catalogArticle.html">文章类别</a></li>
                </ul>
            </li>

            <li class="active">
                <a href="comments.html"><span class="glyphicon glyphicon-equalizer"></span>评论</a>
            </li>
            <li>
                <a href="users.html"><span class="glyphicon glyphicon-equalizer"></span>用户</a>
            </li>
            <li>
                <a href="#menu-settings" class="collapsed" data-toggle="collapse">
                    <span class="glyphicon glyphicon-equalizer"></span>设置<i class="glyphicon glyphicon-menu-down"></i>
                </a>
                <ul id="menu-settings" class="collapse">
                    <li><a href="rotation.html">图片轮播</a></li>
                    <li><a href="settings.html">网站设置</a></li>
                </ul>
            </li>
        </ul>
    </div>
    <!-- 2、主体内容区域 -->
    <div class="main">
        <!-- 2-1-顶部小白条 -->
        <div class="navbar">
            <h3 class="title">所有评论</h3>
            <ul>
                <li><a href="resetPwd.html"><i class="glyphicon glyphicon-wrench"></i> 修改密码</a></li>
                <li><a href="login.html"><i class="glyphicon glyphicon-off"></i> 退出登录</a></li>
            </ul>
        </div>
        <!-- 2-2-主体内容 -->
        <div class="container-box">
            <!-- 2-2-1-分页 -->
            <div class="page-box">
                <ul class="pagination pull-right" id="pageList">
                    <li>
                        <a href="#" aria-label="Previous">
                            <span aria-hidden="true">上一页</span>
                        </a>
                    </li>
                    <li><a href="#">1</a></li>
                    <li><a href="#">2</a></li>
                    <li>
                        <a href="#" aria-label="Next">
                            <span aria-hidden="true">下一页</span>
                        </a>
                    </li>
                </ul>
            </div>
            <!-- 2-2-2表格 -->
            <table class="table table-striped table-bordered table-hover ">
                <thead>
                    <tr>
                        <th>作者</th>
                        <th>评论</th>
                        <th>评论在</th>
                        <th>提交于</th>
                        <th>状态</th>
                        <th class="text-center" width="200">操作</th>
                    </tr>
                </thead>
                <tbody>

                    <tr>
                        <td>小不点</td>
                        <td>好好学习，天天向上</td>
                        <td>《Hello world》</td>
                        <td>2020/10/07</td>
                        <td>已批准</td>
                        <td class="text-center">
                            <a href="javascript:;" class="btn btn-primary btn-sm">批准</a>
                            <a href="javascript:;" class="btn btn-danger btn-sm">删除</a>
                        </td>
                    </tr>
                    <tr>
                        <td>汪十六</td>
                        <td>好好学习，天天向上</td>
                        <td>《Hello world》</td>
                        <td>2020/10/07</td>
                        <td>已批准</td>
                        <td class="text-center">
                            <a href="javascript:;" class="btn btn-warning btn-sm">驳回</a>
                            <a href="javascript:;" class="btn btn-danger btn-sm">删除</a>
                        </td>
                    </tr>
                    <tr>
                        <td>珍珠</td>
                        <td>好好学习，天天向上</td>
                        <td>《Hello world》</td>
                        <td>2020/10/07</td>
                        <td>已批准</td>
                        <td class="text-center">
                            <a href="javascript:;" class="btn btn-warning btn-sm">驳回</a>
                            <a href="javascript:;" class="btn btn-danger btn-sm">删除</a>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>

    </div>



    <!-- js -->
    <script src="../assets/js/jquery.min.js"></script>
    <script src="../assets/js/bootstrap.min.js"></script>
    <script src="../assets/js/common.js"></script>
    <script src="../assets/utils/art-template/template-web.js"></script>
    <script src="../assets/js/comments.js"></script>
    <!-- 评论列表模板-开始 -->
    <script type="text/html" id="commListTpl">
        {{each records}}
        <tr>
            <td>{{$value.author.nickName}}</td>
            <td>{{$value.content}}</td>
            <td>{{$value.post.title}}</td>
            <td>{{$imports.formate( $value.createAt)}}</td>
            <td>{{$value.state ==0?'未审核':'已批准'}}</td>
            <td class="text-center">
                <a href="javascript:;" data-id="{{$value._id}}" data-status="{{$value.state}}" class="btn btn-success btn-sm statusBtn">
                    {{$value.state == 0?'批准':'驳回'}}
                </a>
                <a href="javascript:;" data-id="{{$value._id}}" class="btn btn-danger btn-sm deleteBtn">删除</a>
            </td>
        </tr>
        {{/each}}
    </script>
    <!-- 评论列表模板-结束 -->
    <!-- 分页模板-开始 -->
    <script type="text/html" id="pageListTpl">
        {{if page>1}}
        <li>
            <a href="javascript:;" aria-label="Previous" onclick="changePage(page-1)">
                <span aria-hidden="true">上一页</span>
            </a>
        </li>
        {{/if}}
        {{each display}}
        <li><a href="javascript:;" onclick="changePage({{$value}})">{{$value}}</a></li>
        {{/each}}
        {{if page < pages}}
        <li>
            <a href="javascript:;" aria-label="Next" onclick="changePage(page+1)">
                <span aria-hidden="true">下一页</span>
            </a>
        </li>
        {{/if}}
    </script>
    <!-- 分页模板-结束 -->
    <script>
        NProgress.done()
    </script>
</body>

</html>